package com.fcg.multiproject01.webmodule.config;

import com.fcg.multiproject01.webmodule.filter.CommonFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.Ordered;

/**
 * @author FCG
 */
@Configuration
public class WebConfig {

    @Bean
    public FilterRegistrationBean<CommonFilter> commonFilterFilterRegistrationBean() {
        CommonFilter commonFilter = new CommonFilter();
        FilterRegistrationBean<CommonFilter> registrationBean = new FilterRegistrationBean<>();
        registrationBean.setFilter(commonFilter);
        registrationBean.addUrlPatterns("/*");
        registrationBean.setName("Common_Filter");
        registrationBean.setOrder(Ordered.LOWEST_PRECEDENCE);
        return registrationBean;
    }

}
